package com.wxy.netty.test;

import com.wxy.netty.协议.Message;
import com.wxy.netty.协议.MyServerCodec;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;

public class test {
    public static void main(String[] args) throws Exception {
        EmbeddedChannel channel = new EmbeddedChannel(new LoggingHandler(),
                new MyServerCodec());
        ByteBuf byteBuf = ByteBufAllocator.DEFAULT.buffer();
        Message message = new Message("张三");
        new MyServerCodec().encode(null,message,byteBuf);
        channel.writeInbound(byteBuf);
    }
}
